<template>
	<view class="help-center" :style="{minHeight: Wheight + 'px'}">
		<view class="help-center-box" v-if="listShow">
			<view class="title">{{title}}</view>
			<view class="subheading">{{title}}</view>
			<view class="genre">
				<view class="small-title">各采集站点帮助:</view>
				<view class="list">
					<view class="list-item" v-for="(item, index) in list">
						<text>{{index+1}}.  </text>
						<text class="list-title" @click="viewDetails(item)"> {{item.title}}</text>
					</view>
				</view>
			</view>
		</view>
		<view class="help-center-box details" v-else>
			<view class="close" @click="closeDetails">
				<text>关闭</text>
			</view>
			<view class="title">{{title}}</view>
			<view class="genre">
				<view class="list">
					<view class="list-item">
						<text v-html="itemText"></text>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "helpCenter",
		data() {
			return {
				title: '采集帮助中心',
				list: [],
				Wheight: '',
				itemText: '', //详情
				listShow: true, //列表显示
			}
		},
		onLoad() {
			this.Wheight = this.$store.state.ContentHeight-44;
			this.getList();
		},
		methods: {
			//获取列表
			getList() {
				this.$post(this.api.indexBangzhu).then((res) => {
					console.log(res);
					this.list = res.data;
				}).catch((err) => {
					console.log(err)
				})
			},
			//查看详情
			viewDetails(val) {
				this.listShow = false;
				this.itemText = val.content
			},
			// 关闭详情页面
			closeDetails() {
				this.listShow = true;
			}
		}
	}
</script>

<style lang="less" scoped>
	.help-center{
		width: 100%;
		background: #eeeeee;
		padding: 40rpx 0;
		box-sizing: border-box;
		&-box{
			width: 668rpx;
			margin: auto;
			background: #fff;
			padding: 40rpx;
			box-sizing: border-box;
			border-radius: 5px;
			@margin: 40rpx;
			.title{
				width: 100%;
				padding-bottom: @margin;
				text-align: center;
				font-size: 50rpx;
				border-bottom: 1px solid #eeeeee;
			}
			.subheading{
				font-size: 64rpx;
				margin-top: @margin;
				color: #333333;
				padding-bottom: 8rpx;
				border-bottom: 4rpx solid #CBCBCB;
				font-weight: bold;
			}
			.genre{
				padding: 40rpx 0 0 0;
				.small-title{
					font-size: 30rpx;
					color: #333333;
				}
				.list{
					.list-item{
						padding: 25rpx 0;
						.list-title{
							color: #3186E6;
							font-size: 30rpx;
							margin-left: 8rpx;
						}
					}
				}
			}
		}
		.details{
			position: relative;
			.close{
				position: absolute;
				right: -10rpx;
				top: -20rpx;
				background: rgba(0,0,0,0.4);
				padding: 15rpx 35rpx;
				border-radius: 10rpx;
				color: #fff;
			}
		}
	}
</style>
